package com.yidu.hbatsft.service.impl;

import com.github.pagehelper.PageHelper;
import com.yidu.hbatsft.dao.AtsBaseSportMapper;
import com.yidu.hbatsft.domain.AtsBaseSport;
import com.yidu.hbatsft.service.AtsBaseSportService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class AtsBaseSportServiceImpl implements AtsBaseSportService {
    @Resource
    private AtsBaseSportMapper atsBaseSportMapper;

    @Override
    public List<AtsBaseSport> selAllSportNmae() {
        return atsBaseSportMapper.selAllSportNmae();
    }

    @Override
    public List<AtsBaseSport> selectAllPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        //开始处和数目
        System.out.println(pageNum+"==============="+pageSize);
        return atsBaseSportMapper.selectAll();
    }

    @Override
    public List<AtsBaseSport> selectAll() {
        return atsBaseSportMapper.selectAll();
    }

    @Override
    public AtsBaseSport selectByPrimaryKey(Integer sportId) {
        return atsBaseSportMapper.selectByPrimaryKey(sportId);
    }

    @Override
    public int deleteSp(Integer integer) {
        return atsBaseSportMapper.updateId(integer);
    }

    @Override
    public int insert(AtsBaseSport atsBaseSport) {
        atsBaseSport.setCreatTime(new Date());
        atsBaseSport.setIsva(1);
        return atsBaseSportMapper.insert(atsBaseSport);
    }

    @Override
    public int insertUpdate(AtsBaseSport atsBaseSport) {
        atsBaseSport.setCreatTime(new Date());
        return atsBaseSportMapper.updateByPrimaryKeySelective(atsBaseSport);
    }

    @Override
    public AtsBaseSport findId(Integer sportId) {
        return atsBaseSportMapper.findId(sportId);
    }

    @Override
    public List<AtsBaseSport> findName(String name) {
        return atsBaseSportMapper.findName(name);
    }

    @Override
    public List<AtsBaseSport> findNamePage(String name,Integer pageNum,Integer pageSize) {
        //开始的页数和数目
        PageHelper.startPage(pageNum,pageSize);
        //开始处和数目
        System.out.println(pageNum+"==============="+pageSize);
        return atsBaseSportMapper.findName(name);
    }

    @Override
    public AtsBaseSport selSportNmaeLX(Integer sportId) {
        return atsBaseSportMapper.selSportNmaeLX(sportId);
    }

    @Override
    public List<AtsBaseSport> selectXmAll() {
        return null;
    }
}
